//
//  HomeNet.m
//  beautyLamp
//
//  Created by Tam Kwok To Michael on 2017/9/28.
//  Copyright © 2017年 Tam Kwok To Michael. All rights reserved.
//

#import "HomeNet.h"
#import "BLHeader.h"
#import "BasicNetManager.h"
#import "HomeProduct.h"
#import <YYModel.h>

@implementation HomeNet

+ (void)getImageList:(NSString *)pageIndex  compelter:(void(^)(id result, NSError *error))completer {
    BasicNetManager *manager = [BasicNetManager share];
    NSDictionary *dic = @{@"pageIndex" : pageIndex, @"pageNumber" : @"15"};
    [manager postURL:HOMEIMAGELIST param:dic completer:^(id result, NSError *error) {
        NSMutableArray *images;
        if (result) {
            images = [[NSMutableArray alloc] init];
            NSArray *array = result;
            HomeProduct *product;
            for (NSDictionary *dic in array) {
                product = [HomeProduct yy_modelWithJSON:dic];
                [images addObject:product];
            }
        }
        if (completer) {
            completer(images, error);
        }
    }];
}

@end
